package cn.com.surker.lab.dao;

import cn.com.surker.lab.entity.LabExpendUpload;
import cn.com.surker.lab.vo.LabExpendUploadVo;
import cn.com.surker.production.entity.ProductionIndent;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;

/**
 * <p>
 * 技术上传配合表 Mapper 接口
 * </p>
 *
 * @author admin
 * @since 2024-10-25
 */
public interface LabExpendUploadDao extends BaseMapper<LabExpendUpload> {

    /**
     * 分页查询配合比任务单
     * @param page
     * @param queryWrapper
     * @param <E>
     * @return
     */
    <E extends IPage<ProductionIndent>> E selectFullPage(E page, @Param(Constants.WRAPPER) Wrapper<ProductionIndent> queryWrapper);
	<E extends IPage<ProductionIndent>> E selectFullPageV1(E page, @Param(Constants.WRAPPER) Wrapper<ProductionIndent> queryWrapper, String dbCode);
	/**
	 * 查询任务单下最新的上传记录
	 *
	 * @param orgId
	 * @param indentId
	 * @param lineId
	 * @return
	 */
	List<LabExpendUpload> queryByIndentId(String dbCode,Long orgId, Long indentId, Long lineId);

	/**
	 * findUploadHistory
	 * @param indentId
	 * @param strengthId
	 * @return
	 */
	List<Map<String, Object>> findUploadHistory(String dbCode,Long indentId, Long strengthId);

	/**
	 * 根据任务单，查询上传记录
	 * @param indentId
	 * @return
	 */
	List<LabExpendUploadVo> findIndentHistory(String dbCode,Long indentId);

	/**
	 * 根据强度查询历史上传配比记录
	 * @param dbCode
	 * @param indentId
	 * @param strengthId
	 * @return
	 */
	List<LabExpendUploadVo>  findStrengthHistory(String dbCode,Long lineId, Long strengthId);
	/**
	 * 查询生产线的保存配比记录
	 * @param indentId
	 * @param lines
	 * @return
	 */
	List<LabExpendUpload> findIndentOrLine(String dbCode,Long indentId, List<Long> lines);

	/**
	 * 查询生产线最新的保存记录
	 * @param dbCode
	 * @param indentId
	 * @param lineId
	 * @return
	 */
	LabExpendUpload findLastLine(String dbCode, Long indentId,Long lineId);
}
